package ch.sv7.tool.dbmanager.db;

import junit.framework.TestCase;
import ch.sv7.tool.dbmanager.Context;
import ch.sv7.tool.dbmanager.db.dialect.DefaultDialect;
import ch.sv7.tool.dbmanager.types.SybaseStaticTypesInfo;

/**
 * TODO: Document me!
 *
 * @author svt
 *
 */
public class ContextTestCase extends TestCase {

	public void testContextNull() throws Exception {
		Context ctx = new Context(null, null);
		assertNotNull(ctx);
	}
	
	public void testContextSybase() throws Exception {
		Context ctx = new Context(new DefaultDialect(new SybaseStaticTypesInfo()), null);
		assertNotNull(ctx);
		
		assertTrue(ctx.doRecreateEmptyTable());
	}
	
	public void testContextSybaseWithBadProps() throws Exception {
		Context ctx = new Context(
				new DefaultDialect(
						new SybaseStaticTypesInfo()), 
				"oqiejgh02389nmkmkl");
		assertNotNull(ctx);
		
		assertTrue(ctx.doRecreateEmptyTable());
	}
	
	public void testContextSybaseWithGoodProps() throws Exception {
		Context ctx = new Context(
				new DefaultDialect(
						new SybaseStaticTypesInfo()), 
				"Feature.reCreateEmptyTable=false");
		assertNotNull(ctx);
		
		assertFalse(ctx.doRecreateEmptyTable());
	}
}
